from django.utils.deprecation import MiddlewareMixin
from apps.cms_user.models import UserInfo

class CmsUserMiddleware(MiddlewareMixin):
    def process_request(self,request):
        user_id = request.session.get("user_id",0)
        user_obj = UserInfo.objects.filter(id=user_id).first()
        request.cms = user_obj